package com.tasly.bad;

import com.tasly.common.IMatter;
import com.tasly.common.ceiling.OnAverageCeiling;
import com.tasly.common.ceiling.SpecialShapedCeiling;
import com.tasly.common.coat.DuoLeShiCoat;
import com.tasly.common.coat.LiBangCoat;
import com.tasly.common.floor.DerFloor;
import com.tasly.common.floor.ShengXiangFloor;
import com.tasly.common.tile.DongPengTile;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;

/**
 * ClassName:DecorationPackage
 * Description:
 *
 * @Author 肖宝成
 * @Create 2024/12/17 0:06
 * @Version 1.0
 */
public class DecorationPackage {
    public String getMatterList(Double area, String level) {
        ArrayList<IMatter> list = new ArrayList<>();
        BigDecimal totalPrice = BigDecimal.ZERO;

        if ("豪华欧式".equals(level)) {
            SpecialShapedCeiling specialShapedCeiling = new SpecialShapedCeiling();
            list.add(specialShapedCeiling);
            totalPrice = totalPrice.add(new BigDecimal(area).multiply(new BigDecimal(specialShapedCeiling.price())));
            LiBangCoat liBangCoat = new LiBangCoat();
            list.add(liBangCoat);
            totalPrice = totalPrice.add(new BigDecimal(area).multiply(new BigDecimal(liBangCoat.price())));
            DerFloor derFloor = new DerFloor();
            list.add(derFloor);
            totalPrice = totalPrice.add(new BigDecimal(area).multiply(new BigDecimal(derFloor.price())));
        }
        if("轻奢田园".equals(level)){
            OnAverageCeiling onAverageCeiling = new OnAverageCeiling();
            list.add(onAverageCeiling);
            totalPrice = totalPrice.add(new BigDecimal(area).multiply(new BigDecimal(onAverageCeiling.price())));
            DuoLeShiCoat duoLeShiCoat = new DuoLeShiCoat();
            list.add(duoLeShiCoat);
            totalPrice = totalPrice.add(new BigDecimal(area).multiply(new BigDecimal(duoLeShiCoat.price())));
            DerFloor derFloor = new DerFloor();
            list.add(derFloor);
            totalPrice = totalPrice.add(new BigDecimal(area).multiply(new BigDecimal(derFloor.price())));
            DongPengTile dongPengTile = new DongPengTile();
            list.add(dongPengTile);
            totalPrice = totalPrice.add(new BigDecimal(area).multiply(new BigDecimal(dongPengTile.price())));
        }
        if("现代简约".equals(level)){
            OnAverageCeiling onAverageCeiling = new OnAverageCeiling();
            list.add(onAverageCeiling);
            totalPrice = totalPrice.add(new BigDecimal(area).multiply(new BigDecimal(onAverageCeiling.price())));
            DuoLeShiCoat duoLeShiCoat = new DuoLeShiCoat();
            list.add(duoLeShiCoat);
            DongPengTile dongPengTile = new DongPengTile();
            list.add(dongPengTile);
            totalPrice = totalPrice.add(new BigDecimal(area).multiply(new BigDecimal(dongPengTile.price())));
        }

        StringBuilder detail = new StringBuilder("\n-------------------------------------------------------\n" +
                "装修清单" + "\r\n" +
                        "套餐等级：" + level + "\r\n" +
                        "套餐价格：" + totalPrice.setScale(2, RoundingMode.HALF_UP) +
                        " 元\r\n" +
                        "房屋⾯积：" + area.doubleValue() + " 平⽶\r\n" +
                        "材料清单：\r\n");
        for (IMatter item: list) {

            detail.append(item.scene()).append("：").append(item.brand()).append(
                    "、").append(item.model()).append("、平⽶价格：").append(item.price()).append(" 元。\n");
        }
        return detail.toString();
    }
}
